package com.alibaba.cloud.client9092.controller;

import com.alibaba.cloud.client9092.entity.User;
import com.alibaba.cloud.client9092.service.ClientFeignService;
import com.alibaba.cloud.client9092.service.IndexService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
@RefreshScope
@RestController
public class IndexController {

    @Autowired
    private ClientFeignService clientFeignService;

    @Autowired
    private IndexService indexService;
    @GetMapping("/get")
    public String getFeign() {
        return clientFeignService.get();
    }

    @GetMapping("port")
    public String port1(User user) {

        return "port";
    }



    @PostMapping("post")
    public String post(@RequestBody User user) {

        return "port";
    }


    @GetMapping("save")
    public int save(String name) {

        return indexService.insert(name);
    }

}
